package
{
	import caurina.transitions.Tweener;
	
	import flash.events.Event;
	import flash.events.TimerEvent;

	public class upMenu extends Menu
	{
		private var bg:ImageSprite = null;
		private var collectButton:CommandButton = null;
		public function upMenu(){
			super();
			buttonWidth=100;
		}
		
		public function giveBackground(st:String,w:int):void{
			bg=new ImageSprite();
			bg.overrideSize(w,0);
			addChild(bg);
			bg.load(null,st);
		}
		
		override public function add(str:String,collect:Boolean=false):Button{
			var b:CommandButton = new CommandButton(this);
			b.setPosition(10+(buttonWidth-15)*buttons.length,35);
			b.giveRenderSprite(r);
			b.overrideSize(buttonWidth,buttonWidth);
			b.load(this,str);
			addChild(b);
			buttons.push(b);
			if(collect) collectButton = b;
			this.y=Render.SCR_HGT;
			return b;
		}
		
		override public function show():void{
			r.addChild(this);
			r.openMenuWoosh.play();
			//super.show();
			this.x=xmove;
			showing=true;
			Tweener.addTween(this,{y:Render.SCR_HGT-shift-this.height,time: 1});
		}
						
		public function showWithResource(b:Building):void{
			
			if (collectButton!=null) collectButton.beginDisplayResource(b);
			show();
		}
		
		override public function hide():void{
			showing=false;
			Tweener.addTween(this,{y:Render.SCR_HGT,time: 1});
			r.closeMenuWoosh.play();
		}
	}
}